package com.wswy.wzcx.widget.drawable

import android.content.Context
import android.graphics.Canvas
import android.support.v4.content.ContextCompat
import com.blankj.utilcode.util.SizeUtils
import com.wswy.wzcx.R

class AddDrawable(private val context: Context, private val bgColor:Int) : BaseDrawable(){

       private val dd = ContextCompat.getDrawable(context, R.drawable.pic_add_grey)?.apply {
           setBounds(0,0, SizeUtils.dp2px(24f),SizeUtils.dp2px(24f))
       }

        override fun draw(canvas: Canvas) {
            dd?.let {

                canvas.drawColor(bgColor)

                canvas.save()
                canvas.translate(intrinsicWidth/2f-it.intrinsicWidth/2,intrinsicHeight/2f-it.intrinsicHeight/2)
                it.draw(canvas)
                canvas.restore()
            }
        }

    }
